1
2
3
4 package joeq.Linker.ELF;
5
6 import java.io.IOException;
7
8 /***
9 *
10 * @author John Whaley <jwhaley@alum.mit.edu>
11 * @version $Id: RelocAEntry.java 1451 2004-03-09 06:27:08Z jwhaley $
12 */
13 public class RelocAEntry extends RelocEntry {
14
15 protected int addend;
16
17 public RelocAEntry(int offset, SymbolTableEntry e, byte type, int addend) {
18 super(offset, e, type);
19 this.addend = addend;
20 }
21
22 public final int getAddEnd() { return addend; }
23
24 public void write(ELF file) throws IOException {
25 file.write_addr(getOffset());
26 file.write_word(getInfo());
27 file.write_sword(getAddEnd());
28 }
29
30 public static RelocEntry read(ELF file, Section.SymTabSection s) throws IOException {
31 int offset = file.read_addr();
32 int info = file.read_word();
33 int addend = file.read_sword();
34 int stindex = (info >>> 8);
35 byte type = (byte)info;
36 SymbolTableEntry e = s.getSymbolTableEntry(stindex);
37 return new RelocAEntry(offset, e, type, addend);
38 }
39
40 public static int getEntrySize() { return 12; }
41 }